<!DOCTYPE html>
<!--suppress ALL-->
<html xmlns:th="http://www.thymeleaf.org">
<html>
<head>
    <base th:href="@{/}"><!-- 不用base就使用th:src="@{/js/jquery.min.js} -->
    <meta charset="UTF-8">
    <title>管理员登录</title>
    <link rel="stylesheet" type="text/css" href="css/public.css"/>
    <link rel="stylesheet" type="text/css" href="css/login.css"/>
    <link rel="stylesheet" href="layui/css/modules/layer/default/layer.css">
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
    <script src="js/jquery.min.js"></script>
    <script src="js/common.js"></script>
    <script src="layui/layui.js"></script>
</head>
<body>
<!-------------------登录-------------------------->
<div class="reg">
    <form th:action="@{admin/doAdminLogin}" method="post">
        <h1><img src="img/temp/logo.png"></h1>
        <h1>管理员登录</h1>
        <p><input type="text" id="userName" name="adminName" value="" placeholder="请输入用户名"></p>
        <p><input type="text" id="password" name="adminPassword" value="" placeholder="请输入密码"></p>
        <p class="txtL txt"><input class="code" type="text" name="code" id="code" value="" placeholder="请输入验证码">
            <img th:src="@{/getCode}" id="mycode" height="34px">
        </p>
        <p style="font-size: 15px"><a href="javascript:refreshCode()" >看不清? 换一张</a></p>
        <p><input type="submit" name="" value="登录"></p>
        <span style="color: #a10000" th:text="${msg}"></span>
    </form>
</div>
</body>
<script>
    //刷新验证码
    function refreshCode(){
        $("#mycode").attr("src","/furniture/getCode?time="+new Date().getTime());
    }

    $("#emailLogin").click(function () {
        location.href = "/furniture/user/toEmailLogin";
    })
    //检测用户名输入是否为空
    $("#userName").blur(function () {
        var userName = $("#userName").val();
        if (userName==null||userName==""){
            layer.msg("用户名必填");
        }
    });
    //检测密码输入是否为空
    $("#password").blur(function () {
        var userName = $("#userName").val();
        var password = $("#password").val();
        if ((userName!=null||userName!="")&&(password==null||password=="")){
            layer.msg("密码必填");
        }
    });
    //检测验证码输入是否为空
    $("#code").blur(function () {
        var code = $("#code").val();
        if (code==null||code==""){
            layer.msg("验证码必填");
        }
    });
</script>
</html>
